public abstract class Paper {
    private final String title;
    private final PaperType type;
    private boolean isSelected = false;

    public Paper(String title, PaperType type) {
        this.title = title;
        this.type = type;
    }

    public PaperType getType() {
        return type;
    }

    public synchronized boolean select() {
        if (isSelected) return false;
        isSelected = true;
        return true;
    }

    public String getTitle() {
        return title;
    }

    public String toString() {
        return type + ": " + title;
    }
}

class Thesis extends Paper {
    public Thesis(String title) {
        super(title, PaperType.Thesis);
    }
}

class JournalPaper extends Paper {
    public JournalPaper(String title) {
        super(title, PaperType.JournalPaper);
    }
}

class ConferencePaper extends Paper {
    public ConferencePaper(String title) {
        super(title, PaperType.ConferencePaper);
    }
}
